package logic

import (
	"common"
	"common/grpcx"
	"gateway/internal/pb"
	"time"
)

// GetSwiperList 通过grpc获取轮播图
func GetSwiperList(status *uint32) (*pb.SwiperListResponse, error) {
	conn, err := grpcx.NewNoCertConn("swiper")
	if err != nil {
		return nil, err
	}
	defer conn.Close()
	client := pb.NewSwiperClient(conn)
	ctx, cancel := common.WithTimeoutContext(time.Second * 2)
	defer cancel()
	return client.SwiperList(ctx, &pb.SwiperListRequest{
		Status: status,
	})
}
